#include <iostream>
#include <thread>
#include <chrono>
#include <functional>

// 模拟异步操作
void asyncOperation(std::function<void(std::string)> callback) {
    std::cout <<"11111"<<std::endl;
    std::this_thread::sleep_for(std::chrono::seconds(2));  // 模拟耗时操作
    std::cout <<"11111"<<std::endl;
    callback("Operation complete");  // 操作完成后调用回调
}

int main() {
    std::cout << "Starting async operation..." << std::endl;

    // 异步操作的回调函数
    asyncOperation([](std::string result) {
        std::cout << "Callback: " << result << std::endl;
    });

    std::cout <<"11111"<<std::endl;
    std::cout << "Doing something else while waiting..." << std::endl;
    
    std::cin.get();  // 防止主程序退出
    return 0;
}